<template>
  <j-modal title="视频预览" width="800px" :visible.sync="visible" okText="确定" @ok="handleOk" @cancel="handleOk">
    <div ref="mse"></div>
  </j-modal>
</template>

<script>
//分享modal
import { postAction } from '@/api/manage'
import 'xgplayer'
import Player from 'xgplayer-hls'

export default {
  name: 'MovieModal',
  data() {
    return {
      visible: false,
      item: {},
      player: null
    }
  },
  created() {},
  mounted() {},
  methods: {
    show(item) {
      this.item = item
      this.visible = true
      
      this.$nextTick(function() {
        console.log(item)
        this.player = new Player({
          el: this.$refs.mse,
          url: 'http://' + item.m3u8Url,
          fluid: true,
          poster: 'http://' + item.imageUrl
        })
      })
    },
    handleOk() {
      this.player.destroy(true)
      this.visible = false
    }
  }
}
</script>

<style scoped>
#mse {
  width: 752px;
}

video {
  
}
</style>
